package com.it.service.impl;

import com.it.mapper.WasteMapper;
import com.it.pojo.Waste;
import com.it.pojo.WasteExample;
import com.it.service.WasteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: zgc
 * @version: 1.0
 * @description:
 * @date: 2023/12/25 11:37
 */
@Service
@Transactional
public class WasteServiceImpl implements WasteService {

    @Autowired
    private WasteMapper wasteMapper;

    @Override
    public List<Waste> findTypeId(String typeId) {
        WasteExample example = new WasteExample();
        WasteExample.Criteria criteria = example.createCriteria();
        criteria.andTypeIdEqualTo(typeId);
        criteria.andTypeIdLike(typeId+"%");
        return wasteMapper.selectByExample(example);
    }

    @Override
    public Waste findById(String id) {
        return wasteMapper.selectByPrimaryKey(id);
    }
}
